package cl.parser.internal;

import java.util.ArrayList;
import java.util.List;

import cl.parser.IParseNode;
import cl.parser.external.SemicolonNode;

public class StatementNode extends InternalNode {

    @Override
    public String prettyPrint(String indent) {
        return indent + children.get(0).prettyPrint(indent) + "\n";
    }
    
    @Override
    protected List<IParseNode> getAllowed(IParseNode last, List<IParseNode> soFar) {
        List<IParseNode> allowed = new ArrayList<IParseNode>();
        
        if(last == null) {
            allowed.add(new FunctionCallNode());
            allowed.add(new AssignmentNode());
            allowed.add(new VariableDeclarationNode());
            allowed.add(new IfNode());
            allowed.add(new WhileNode());
            allowed.add(new SemicolonNode());
        }
        
        return allowed;
    }

    @Override
    protected boolean isValid(IParseNode last, List<IParseNode> soFar) {
        return last != null;
    }

}
